﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Inovout.Membership.Security.OAuth.AuthorizationServer.Mail
{
    public  class UserInfo
    {
        [Display(Name = "用户Id")]
        public string Userid { get; set; }
        [Display(Name = "姓名")]
        public string Name { get; set; }
        [Display(Name = "部门Id")]
        public string Departmentid { get; set; }
        [Display(Name = "职位")]
        public string Office { get; set; }
        [Display(Name = "手机号码")]
        public string Mobile { get; set; }
        [Display(Name = "固定电话")]
        public string Phone { get; set; }
        [Display(Name = "传真")]
        public string Fax { get; set; }
        //[Display(Name = "邮箱后缀名")]
        //public string Domain { get; set; }
        public override bool Equals(object obj)
        {
            UserInfo that = obj as UserInfo;
            //Check whether the compared objects reference the same data.
            if (Object.ReferenceEquals(this, that)) return true;

            //Check whether any of the compared objects is null.
            if (Object.ReferenceEquals(this, null) || Object.ReferenceEquals(that, null))
                return false;

            //Check whether the products' properties are equal.
            return this.Userid == that.Userid;
        }

        // If Equals() returns true for a pair of objects 
        // then GetHashCode() must return the same value for these objects.
        public override int GetHashCode()
        {

            //Get hash code for the Name field if it is not null.
            return string.IsNullOrEmpty(this.Userid) ? 0 : this.Userid.GetHashCode();

        }
    }
}
